1. Field
The present invention relates to techniques for improving multiprocessor performance. More specifically, the present invention relates to a technique for implementing an efficient spin-lock in a shared memory multiprocessor system.
2. Related Art
A spin-lock is commonly used to synchronize actions between multiple threads in a computer system. When a given thread attempts to acquire a spin-lock and detects that the spin-lock is held by another thread, the given thread repeatedly attempts to acquire the lock, or repeatedly checks the status of the lock and then attempts to acquire the lock when the status indicates the lock is free.
Spin-locks are commonly used because they are simple to implement and because they have good performance for lightly contested locks. However, spin-locks can suffer from high hand-over latency, which occurs when a spin-lock is contested. More specifically, the hand-over latency is the time from when the current lock owner frees the lock to when the next owner acquires the lock. Additionally, contested spin-locks can cause a significant amount of coherence traffic in cache-coherent, shared memory multiprocessor systems.
Hence, what is needed is a method and an apparatus for implementing spin-locks without the associated hand-over latency and coherence traffic.